package managers

import (
	"myself/db/models"
	"myself/util"
)

type accountManager struct {
	BaseManager
}

var account *accountManager
var onceAccount util.Once

func NewAccountManger() (*accountManager, error) {
	err := onceAccount.Do(func() error {
		if account == nil {
			conn, err := InitDb()
			if err != nil {
				return err
			}
			account = &accountManager{}
			account.SetModel(&models.Account{})
			account.SetConn(conn)
		}
		return nil
	})
	return account, err
}
